home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / bluetooth / sdp.h < prev   
Encoding:
C/C++ Source or Header  |  2008-11-11  |  16.2 KB  |  504 lines

  1. /*
  2.  *
  3.  *  BlueZ - Bluetooth protocol stack for Linux
  4.  *
  5.  *  Copyright (C) 2001-2002  Nokia Corporation
  6.  *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
  7.  *  Copyright (C) 2002-2008  Marcel Holtmann <marcel@holtmann.org>
  8.  *  Copyright (C) 2002-2003  Stephen Crane <steve.crane@rococosoft.com>
  9.  *
  10.  *
  11.  *  This program is free software; you can redistribute it and/or modify
  12.  *  it under the terms of the GNU General Public License as published by
  13.  *  the Free Software Foundation; either version 2 of the License, or
  14.  *  (at your option) any later version.
  15.  *
  16.  *  This program is distributed in the hope that it will be useful,
  17.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  *  GNU General Public License for more details.
  20.  *
  21.  *  You should have received a copy of the GNU General Public License
  22.  *  along with this program; if not, write to the Free Software
  23.  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  24.  *
  25.  */
  26.  
  27. #ifndef __SDP_H
  28. #define __SDP_H
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #include <stdint.h>
  35.  
  36. #define SDP_UNIX_PATH "/var/run/sdp"
  37. #define SDP_RESPONSE_TIMEOUT    20
  38. #define SDP_REQ_BUFFER_SIZE    2048
  39. #define SDP_RSP_BUFFER_SIZE    65535
  40. #define SDP_PDU_CHUNK_SIZE    1024
  41.  
  42. /*
  43.  * All definitions are based on Bluetooth Assigned Numbers
  44.  * of the Bluetooth Specification
  45.  */
  46. #define SDP_PSM         0x0001
  47.  
  48. /*
  49.  * Protocol UUIDs
  50.  */
  51. #define SDP_UUID    0x0001
  52. #define UDP_UUID    0x0002
  53. #define RFCOMM_UUID    0x0003
  54. #define TCP_UUID    0x0004
  55. #define TCS_BIN_UUID    0x0005
  56. #define TCS_AT_UUID    0x0006
  57. #define OBEX_UUID    0x0008
  58. #define IP_UUID        0x0009
  59. #define FTP_UUID    0x000a
  60. #define HTTP_UUID    0x000c
  61. #define WSP_UUID    0x000e
  62. #define BNEP_UUID    0x000f
  63. #define UPNP_UUID    0x0010
  64. #define HIDP_UUID    0x0011
  65. #define HCRP_CTRL_UUID    0x0012
  66. #define HCRP_DATA_UUID    0x0014
  67. #define HCRP_NOTE_UUID    0x0016
  68. #define AVCTP_UUID    0x0017
  69. #define AVDTP_UUID    0x0019
  70. #define CMTP_UUID    0x001b
  71. #define UDI_UUID    0x001d
  72. #define MCAP_CTRL_UUID    0x001e
  73. #define MCAP_DATA_UUID    0x001f
  74. #define L2CAP_UUID    0x0100
  75.  
  76. /*
  77.  * Service class identifiers of standard services and service groups
  78.  */
  79. #define SDP_SERVER_SVCLASS_ID        0x1000
  80. #define BROWSE_GRP_DESC_SVCLASS_ID    0x1001
  81. #define PUBLIC_BROWSE_GROUP        0x1002
  82. #define SERIAL_PORT_SVCLASS_ID        0x1101
  83. #define LAN_ACCESS_SVCLASS_ID        0x1102
  84. #define DIALUP_NET_SVCLASS_ID        0x1103
  85. #define IRMC_SYNC_SVCLASS_ID        0x1104
  86. #define OBEX_OBJPUSH_SVCLASS_ID        0x1105
  87. #define OBEX_FILETRANS_SVCLASS_ID    0x1106
  88. #define IRMC_SYNC_CMD_SVCLASS_ID    0x1107
  89. #define HEADSET_SVCLASS_ID        0x1108
  90. #define CORDLESS_TELEPHONY_SVCLASS_ID    0x1109
  91. #define AUDIO_SOURCE_SVCLASS_ID        0x110a
  92. #define AUDIO_SINK_SVCLASS_ID        0x110b
  93. #define AV_REMOTE_TARGET_SVCLASS_ID    0x110c
  94. #define ADVANCED_AUDIO_SVCLASS_ID    0x110d
  95. #define AV_REMOTE_SVCLASS_ID        0x110e
  96. #define VIDEO_CONF_SVCLASS_ID        0x110f
  97. #define INTERCOM_SVCLASS_ID        0x1110
  98. #define FAX_SVCLASS_ID            0x1111
  99. #define HEADSET_AGW_SVCLASS_ID        0x1112
  100. #define WAP_SVCLASS_ID            0x1113
  101. #define WAP_CLIENT_SVCLASS_ID        0x1114
  102. #define PANU_SVCLASS_ID            0x1115
  103. #define NAP_SVCLASS_ID            0x1116
  104. #define GN_SVCLASS_ID            0x1117
  105. #define DIRECT_PRINTING_SVCLASS_ID    0x1118
  106. #define REFERENCE_PRINTING_SVCLASS_ID    0x1119
  107. #define IMAGING_SVCLASS_ID        0x111a
  108. #define IMAGING_RESPONDER_SVCLASS_ID    0x111b
  109. #define IMAGING_ARCHIVE_SVCLASS_ID    0x111c
  110. #define IMAGING_REFOBJS_SVCLASS_ID    0x111d
  111. #define HANDSFREE_SVCLASS_ID        0x111e
  112. #define HANDSFREE_AGW_SVCLASS_ID    0x111f
  113. #define DIRECT_PRT_REFOBJS_SVCLASS_ID    0x1120
  114. #define REFLECTED_UI_SVCLASS_ID        0x1121
  115. #define BASIC_PRINTING_SVCLASS_ID    0x1122
  116. #define PRINTING_STATUS_SVCLASS_ID    0x1123
  117. #define HID_SVCLASS_ID            0x1124
  118. #define HCR_SVCLASS_ID            0x1125
  119. #define HCR_PRINT_SVCLASS_ID        0x1126
  120. #define HCR_SCAN_SVCLASS_ID        0x1127
  121. #define CIP_SVCLASS_ID            0x1128
  122. #define VIDEO_CONF_GW_SVCLASS_ID    0x1129
  123. #define UDI_MT_SVCLASS_ID        0x112a
  124. #define UDI_TA_SVCLASS_ID        0x112b
  125. #define AV_SVCLASS_ID            0x112c
  126. #define SAP_SVCLASS_ID            0x112d
  127. #define PBAP_PCE_SVCLASS_ID        0x112e
  128. #define PBAP_PSE_SVCLASS_ID        0x112f
  129. #define PBAP_SVCLASS_ID            0x1130
  130. #define PNP_INFO_SVCLASS_ID        0x1200
  131. #define GENERIC_NETWORKING_SVCLASS_ID    0x1201
  132. #define GENERIC_FILETRANS_SVCLASS_ID    0x1202
  133. #define GENERIC_AUDIO_SVCLASS_ID    0x1203
  134. #define GENERIC_TELEPHONY_SVCLASS_ID    0x1204
  135. #define UPNP_SVCLASS_ID            0x1205
  136. #define UPNP_IP_SVCLASS_ID        0x1206
  137. #define UPNP_PAN_SVCLASS_ID        0x1300
  138. #define UPNP_LAP_SVCLASS_ID        0x1301
  139. #define UPNP_L2CAP_SVCLASS_ID        0x1302
  140. #define VIDEO_SOURCE_SVCLASS_ID        0x1303
  141. #define VIDEO_SINK_SVCLASS_ID        0x1304
  142. #define VIDEO_DISTRIBUTION_SVCLASS_ID    0x1305
  143. #define MDP_SVCLASS_ID            0x1400
  144. #define MDP_SOURCE_SVCLASS_ID        0x1401
  145. #define MDP_SINK_SVCLASS_ID        0x1402
  146. #define APPLE_AGENT_SVCLASS_ID        0x2112
  147.  
  148. /*
  149.  * Standard profile descriptor identifiers; note these
  150.  * may be identical to some of the service classes defined above
  151.  */
  152. #define SDP_SERVER_PROFILE_ID        SDP_SERVER_SVCLASS_ID
  153. #define BROWSE_GRP_DESC_PROFILE_ID    BROWSE_GRP_DESC_SVCLASS_ID
  154. #define SERIAL_PORT_PROFILE_ID        SERIAL_PORT_SVCLASS_ID
  155. #define LAN_ACCESS_PROFILE_ID        LAN_ACCESS_SVCLASS_ID
  156. #define DIALUP_NET_PROFILE_ID        DIALUP_NET_SVCLASS_ID
  157. #define IRMC_SYNC_PROFILE_ID        IRMC_SYNC_SVCLASS_ID
  158. #define OBEX_OBJPUSH_PROFILE_ID        OBEX_OBJPUSH_SVCLASS_ID
  159. #define OBEX_FILETRANS_PROFILE_ID    OBEX_FILETRANS_SVCLASS_ID
  160. #define IRMC_SYNC_CMD_PROFILE_ID    IRMC_SYNC_CMD_SVCLASS_ID
  161. #define HEADSET_PROFILE_ID        HEADSET_SVCLASS_ID
  162. #define CORDLESS_TELEPHONY_PROFILE_ID    CORDLESS_TELEPHONY_SVCLASS_ID
  163. #define AUDIO_SOURCE_PROFILE_ID        AUDIO_SOURCE_SVCLASS_ID
  164. #define AUDIO_SINK_PROFILE_ID        AUDIO_SINK_SVCLASS_ID
  165. #define AV_REMOTE_TARGET_PROFILE_ID    AV_REMOTE_TARGET_SVCLASS_ID
  166. #define ADVANCED_AUDIO_PROFILE_ID    ADVANCED_AUDIO_SVCLASS_ID
  167. #define AV_REMOTE_PROFILE_ID        AV_REMOTE_SVCLASS_ID
  168. #define VIDEO_CONF_PROFILE_ID        VIDEO_CONF_SVCLASS_ID
  169. #define INTERCOM_PROFILE_ID        INTERCOM_SVCLASS_ID
  170. #define FAX_PROFILE_ID            FAX_SVCLASS_ID
  171. #define HEADSET_AGW_PROFILE_ID        HEADSET_AGW_SVCLASS_ID
  172. #define WAP_PROFILE_ID            WAP_SVCLASS_ID
  173. #define WAP_CLIENT_PROFILE_ID        WAP_CLIENT_SVCLASS_ID
  174. #define PANU_PROFILE_ID            PANU_SVCLASS_ID
  175. #define NAP_PROFILE_ID            NAP_SVCLASS_ID
  176. #define GN_PROFILE_ID            GN_SVCLASS_ID
  177. #define DIRECT_PRINTING_PROFILE_ID    DIRECT_PRINTING_SVCLASS_ID
  178. #define REFERENCE_PRINTING_PROFILE_ID    REFERENCE_PRINTING_SVCLASS_ID
  179. #define IMAGING_PROFILE_ID        IMAGING_SVCLASS_ID
  180. #define IMAGING_RESPONDER_PROFILE_ID    IMAGING_RESPONDER_SVCLASS_ID
  181. #define IMAGING_ARCHIVE_PROFILE_ID    IMAGING_ARCHIVE_SVCLASS_ID
  182. #define IMAGING_REFOBJS_PROFILE_ID    IMAGING_REFOBJS_SVCLASS_ID
  183. #define HANDSFREE_PROFILE_ID        HANDSFREE_SVCLASS_ID
  184. #define HANDSFREE_AGW_PROFILE_ID    HANDSFREE_AGW_SVCLASS_ID
  185. #define DIRECT_PRT_REFOBJS_PROFILE_ID    DIRECT_PRT_REFOBJS_SVCLASS_ID
  186. #define REFLECTED_UI_PROFILE_ID        REFLECTED_UI_SVCLASS_ID
  187. #define BASIC_PRINTING_PROFILE_ID    BASIC_PRINTING_SVCLASS_ID
  188. #define PRINTING_STATUS_PROFILE_ID    PRINTING_STATUS_SVCLASS_ID
  189. #define HID_PROFILE_ID            HID_SVCLASS_ID
  190. #define HCR_PROFILE_ID            HCR_SCAN_SVCLASS_ID
  191. #define HCR_PRINT_PROFILE_ID        HCR_PRINT_SVCLASS_ID
  192. #define HCR_SCAN_PROFILE_ID        HCR_SCAN_SVCLASS_ID
  193. #define CIP_PROFILE_ID            CIP_SVCLASS_ID
  194. #define VIDEO_CONF_GW_PROFILE_ID    VIDEO_CONF_GW_SVCLASS_ID
  195. #define UDI_MT_PROFILE_ID        UDI_MT_SVCLASS_ID
  196. #define UDI_TA_PROFILE_ID        UDI_TA_SVCLASS_ID
  197. #define AV_PROFILE_ID            AV_SVCLASS_ID
  198. #define SAP_PROFILE_ID            SAP_SVCLASS_ID
  199. #define PBAP_PCE_PROFILE_ID        PBAP_PCE_SVCLASS_ID
  200. #define PBAP_PSE_PROFILE_ID        PBAP_PSE_SVCLASS_ID
  201. #define PBAP_PROFILE_ID            PBAP_SVCLASS_ID
  202. #define PNP_INFO_PROFILE_ID        PNP_INFO_SVCLASS_ID
  203. #define GENERIC_NETWORKING_PROFILE_ID    GENERIC_NETWORKING_SVCLASS_ID
  204. #define GENERIC_FILETRANS_PROFILE_ID    GENERIC_FILETRANS_SVCLASS_ID
  205. #define GENERIC_AUDIO_PROFILE_ID    GENERIC_AUDIO_SVCLASS_ID
  206. #define GENERIC_TELEPHONY_PROFILE_ID    GENERIC_TELEPHONY_SVCLASS_ID
  207. #define UPNP_PROFILE_ID            UPNP_SVCLASS_ID
  208. #define UPNP_IP_PROFILE_ID        UPNP_IP_SVCLASS_ID
  209. #define UPNP_PAN_PROFILE_ID        UPNP_PAN_SVCLASS_ID
  210. #define UPNP_LAP_PROFILE_ID        UPNP_LAP_SVCLASS_ID
  211. #define UPNP_L2CAP_PROFILE_ID        UPNP_L2CAP_SVCLASS_ID
  212. #define VIDEO_SOURCE_PROFILE_ID        VIDEO_SOURCE_SVCLASS_ID
  213. #define VIDEO_SINK_PROFILE_ID        VIDEO_SINK_SVCLASS_ID
  214. #define VIDEO_DISTRIBUTION_PROFILE_ID    VIDEO_DISTRIBUTION_SVCLASS_ID
  215. #define MDP_PROFILE_ID            MDP_SVCLASS_ID
  216. #define MDP_SOURCE_PROFILE_ID        MDP_SROUCE_SVCLASS_ID
  217. #define MDP_SINK_PROFILE_ID        MDP_SINK_SVCLASS_ID
  218. #define APPLE_AGENT_PROFILE_ID        APPLE_AGENT_SVCLASS_ID
  219.  
  220. /*
  221.  * Attribute identifier codes
  222.  */
  223. #define SDP_SERVER_RECORD_HANDLE        0x0000
  224.  
  225. /*
  226.  * Possible values for attribute-id are listed below.
  227.  * See SDP Spec, section "Service Attribute Definitions" for more details.
  228.  */
  229. #define SDP_ATTR_RECORD_HANDLE            0x0000
  230. #define SDP_ATTR_SVCLASS_ID_LIST        0x0001
  231. #define SDP_ATTR_RECORD_STATE            0x0002
  232. #define SDP_ATTR_SERVICE_ID            0x0003
  233. #define SDP_ATTR_PROTO_DESC_LIST        0x0004
  234. #define SDP_ATTR_BROWSE_GRP_LIST        0x0005
  235. #define SDP_ATTR_LANG_BASE_ATTR_ID_LIST        0x0006
  236. #define SDP_ATTR_SVCINFO_TTL            0x0007
  237. #define SDP_ATTR_SERVICE_AVAILABILITY        0x0008
  238. #define SDP_ATTR_PFILE_DESC_LIST        0x0009
  239. #define SDP_ATTR_DOC_URL            0x000a
  240. #define SDP_ATTR_CLNT_EXEC_URL            0x000b
  241. #define SDP_ATTR_ICON_URL            0x000c
  242. #define SDP_ATTR_ADD_PROTO_DESC_LIST        0x000d
  243.  
  244. #define SDP_ATTR_GROUP_ID            0x0200
  245. #define SDP_ATTR_IP_SUBNET            0x0200
  246. #define SDP_ATTR_VERSION_NUM_LIST        0x0200
  247. #define SDP_ATTR_SVCDB_STATE            0x0201
  248.  
  249. #define SDP_ATTR_SERVICE_VERSION        0x0300
  250. #define SDP_ATTR_EXTERNAL_NETWORK        0x0301
  251. #define SDP_ATTR_SUPPORTED_DATA_STORES_LIST    0x0301
  252. #define SDP_ATTR_FAX_CLASS1_SUPPORT        0x0302
  253. #define SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL    0x0302
  254. #define SDP_ATTR_FAX_CLASS20_SUPPORT        0x0303
  255. #define SDP_ATTR_SUPPORTED_FORMATS_LIST        0x0303
  256. #define SDP_ATTR_FAX_CLASS2_SUPPORT        0x0304
  257. #define SDP_ATTR_AUDIO_FEEDBACK_SUPPORT        0x0305
  258. #define SDP_ATTR_NETWORK_ADDRESS        0x0306
  259. #define SDP_ATTR_WAP_GATEWAY            0x0307
  260. #define SDP_ATTR_HOMEPAGE_URL            0x0308
  261. #define SDP_ATTR_WAP_STACK_TYPE            0x0309
  262. #define SDP_ATTR_SECURITY_DESC            0x030a
  263. #define SDP_ATTR_NET_ACCESS_TYPE        0x030b
  264. #define SDP_ATTR_MAX_NET_ACCESSRATE        0x030c
  265. #define SDP_ATTR_IP4_SUBNET            0x030d
  266. #define SDP_ATTR_IP6_SUBNET            0x030e
  267. #define SDP_ATTR_SUPPORTED_CAPABILITIES        0x0310
  268. #define SDP_ATTR_SUPPORTED_FEATURES        0x0311
  269. #define SDP_ATTR_SUPPORTED_FUNCTIONS        0x0312
  270. #define SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY    0x0313
  271. #define SDP_ATTR_SUPPORTED_REPOSITORIES        0x0314
  272.  
  273. #define SDP_ATTR_SPECIFICATION_ID        0x0200
  274. #define SDP_ATTR_VENDOR_ID            0x0201
  275. #define SDP_ATTR_PRODUCT_ID            0x0202
  276. #define SDP_ATTR_VERSION            0x0203
  277. #define SDP_ATTR_PRIMARY_RECORD            0x0204
  278. #define SDP_ATTR_VENDOR_ID_SOURCE        0x0205
  279.  
  280. #define SDP_ATTR_HID_DEVICE_RELEASE_NUMBER    0x0200
  281. #define SDP_ATTR_HID_PARSER_VERSION        0x0201
  282. #define SDP_ATTR_HID_DEVICE_SUBCLASS        0x0202
  283. #define SDP_ATTR_HID_COUNTRY_CODE        0x0203
  284. #define SDP_ATTR_HID_VIRTUAL_CABLE        0x0204
  285. #define SDP_ATTR_HID_RECONNECT_INITIATE        0x0205
  286. #define SDP_ATTR_HID_DESCRIPTOR_LIST        0x0206
  287. #define SDP_ATTR_HID_LANG_ID_BASE_LIST        0x0207
  288. #define SDP_ATTR_HID_SDP_DISABLE        0x0208
  289. #define SDP_ATTR_HID_BATTERY_POWER        0x0209
  290. #define SDP_ATTR_HID_REMOTE_WAKEUP        0x020a
  291. #define SDP_ATTR_HID_PROFILE_VERSION        0x020b
  292. #define SDP_ATTR_HID_SUPERVISION_TIMEOUT    0x020c
  293. #define SDP_ATTR_HID_NORMALLY_CONNECTABLE    0x020d
  294. #define SDP_ATTR_HID_BOOT_DEVICE        0x020e
  295.  
  296. /*
  297.  * These identifiers are based on the SDP spec stating that 
  298.  * "base attribute id of the primary (universal) language must be 0x0100"
  299.  *
  300.  * Other languages should have their own offset; e.g.:
  301.  * #define XXXLangBase yyyy
  302.  * #define AttrServiceName_XXX    0x0000+XXXLangBase
  303.  */
  304. #define SDP_PRIMARY_LANG_BASE         0x0100
  305.  
  306. #define SDP_ATTR_SVCNAME_PRIMARY    0x0000 + SDP_PRIMARY_LANG_BASE
  307. #define SDP_ATTR_SVCDESC_PRIMARY    0x0001 + SDP_PRIMARY_LANG_BASE
  308. #define SDP_ATTR_PROVNAME_PRIMARY    0x0002 + SDP_PRIMARY_LANG_BASE
  309.  
  310. /*
  311.  * The Data representation in SDP PDUs (pps 339, 340 of BT SDP Spec)
  312.  * These are the exact data type+size descriptor values
  313.  * that go into the PDU buffer.
  314.  *
  315.  * The datatype (leading 5bits) + size descriptor (last 3 bits)
  316.  * is 8 bits. The size descriptor is critical to extract the
  317.  * right number of bytes for the data value from the PDU.
  318.  *
  319.  * For most basic types, the datatype+size descriptor is
  320.  * straightforward. However for constructed types and strings,
  321.  * the size of the data is in the next "n" bytes following the
  322.  * 8 bits (datatype+size) descriptor. Exactly what the "n" is
  323.  * specified in the 3 bits of the data size descriptor.
  324.  *
  325.  * TextString and URLString can be of size 2^{8, 16, 32} bytes
  326.  * DataSequence and DataSequenceAlternates can be of size 2^{8, 16, 32}
  327.  * The size are computed post-facto in the API and are not known apriori
  328.  */
  329. #define SDP_DATA_NIL         0x00
  330. #define SDP_UINT8          0x08
  331. #define SDP_UINT16        0x09
  332. #define SDP_UINT32        0x0A
  333. #define SDP_UINT64        0x0B
  334. #define SDP_UINT128        0x0C
  335. #define SDP_INT8        0x10
  336. #define SDP_INT16        0x11
  337. #define SDP_INT32        0x12
  338. #define SDP_INT64        0x13
  339. #define SDP_INT128        0x14
  340. #define SDP_UUID_UNSPEC        0x18
  341. #define SDP_UUID16        0x19
  342. #define SDP_UUID32        0x1A
  343. #define SDP_UUID128        0x1C
  344. #define SDP_TEXT_STR_UNSPEC    0x20
  345. #define SDP_TEXT_STR8        0x25
  346. #define SDP_TEXT_STR16        0x26
  347. #define SDP_TEXT_STR32        0x27
  348. #define SDP_BOOL        0x28
  349. #define SDP_SEQ_UNSPEC        0x30
  350. #define SDP_SEQ8        0x35
  351. #define SDP_SEQ16        0x36
  352. #define SDP_SEQ32        0x37
  353. #define SDP_ALT_UNSPEC        0x38
  354. #define SDP_ALT8        0x3D
  355. #define SDP_ALT16        0x3E
  356. #define SDP_ALT32        0x3F
  357. #define SDP_URL_STR_UNSPEC    0x40
  358. #define SDP_URL_STR8        0x45
  359. #define SDP_URL_STR16        0x46
  360. #define SDP_URL_STR32        0x47
  361.  
  362. /*
  363.  * The PDU identifiers of SDP packets between client and server
  364.  */
  365. #define SDP_ERROR_RSP        0x01
  366. #define SDP_SVC_SEARCH_REQ    0x02
  367. #define SDP_SVC_SEARCH_RSP    0x03
  368. #define SDP_SVC_ATTR_REQ    0x04
  369. #define SDP_SVC_ATTR_RSP    0x05
  370. #define SDP_SVC_SEARCH_ATTR_REQ    0x06
  371. #define SDP_SVC_SEARCH_ATTR_RSP    0x07
  372.  
  373. /*
  374.  * Some additions to support service registration.
  375.  * These are outside the scope of the Bluetooth specification
  376.  */
  377. #define SDP_SVC_REGISTER_REQ    0x75
  378. #define SDP_SVC_REGISTER_RSP    0x76
  379. #define SDP_SVC_UPDATE_REQ    0x77
  380. #define SDP_SVC_UPDATE_RSP    0x78
  381. #define SDP_SVC_REMOVE_REQ    0x79
  382. #define SDP_SVC_REMOVE_RSP    0x80
  383.  
  384. /*
  385.  * SDP Error codes
  386.  */
  387. #define SDP_INVALID_VERSION        0x0001
  388. #define SDP_INVALID_RECORD_HANDLE    0x0002
  389. #define SDP_INVALID_SYNTAX        0x0003
  390. #define SDP_INVALID_PDU_SIZE        0x0004
  391. #define SDP_INVALID_CSTATE        0x0005
  392.  
  393. /*
  394.  * SDP PDU
  395.  */
  396. typedef struct {
  397.     uint8_t  pdu_id;
  398.     uint16_t tid;
  399.     uint16_t plen;
  400. } __attribute__ ((packed)) sdp_pdu_hdr_t;
  401.  
  402. /*
  403.  * Common definitions for attributes in the SDP.
  404.  * Should the type of any of these change, you need only make a change here.
  405.  */
  406. typedef struct {
  407.     uint8_t data[16];
  408. } uint128_t;
  409.  
  410. typedef struct {
  411.     uint8_t type;
  412.     union {
  413.         uint16_t  uuid16;
  414.         uint32_t  uuid32;
  415.         uint128_t uuid128;
  416.     } value;
  417. } uuid_t;
  418.  
  419. #define SDP_IS_UUID(x) ((x) == SDP_UUID16 || (x) == SDP_UUID32 || (x) ==SDP_UUID128)
  420.  
  421. typedef struct _sdp_list sdp_list_t;
  422. struct _sdp_list {
  423.     sdp_list_t *next;
  424.     void *data;
  425. };
  426.  
  427. /*
  428.  * User-visible strings can be in many languages
  429.  * in addition to the universal language.
  430.  *
  431.  * Language meta-data includes language code in ISO639
  432.  * followed by the encoding format. The third field in this
  433.  * structure is the attribute offset for the language.
  434.  * User-visible strings in the specified language can be
  435.  * obtained at this offset.
  436.  */
  437. typedef struct {
  438.     uint16_t code_ISO639;
  439.     uint16_t encoding;
  440.     uint16_t base_offset;
  441. } sdp_lang_attr_t;
  442.  
  443. /*
  444.  * Profile descriptor is the Bluetooth profile metadata. If a
  445.  * service conforms to a well-known profile, then its profile
  446.  * identifier (UUID) is an attribute of the service. In addition,
  447.  * if the profile has a version number it is specified here.
  448.  */
  449. typedef struct {
  450.     uuid_t uuid;
  451.     uint16_t version;
  452. } sdp_profile_desc_t;
  453.  
  454. typedef struct {
  455.     uint8_t major;
  456.     uint8_t minor;
  457. } sdp_version_t;
  458.  
  459. typedef struct {
  460.     uint8_t *data;
  461.     uint32_t data_size;
  462.     uint32_t buf_size;
  463. } sdp_buf_t;
  464.  
  465. typedef struct {
  466.     uint32_t handle;
  467.  
  468.     /* Search pattern: a sequence of all UUIDs seen in this record */
  469.     sdp_list_t *pattern;
  470.     sdp_list_t *attrlist;
  471.  
  472.     /* Main service class for Extended Inquiry Response */
  473.     uuid_t svclass;
  474. } sdp_record_t;
  475.  
  476. typedef struct sdp_data_struct sdp_data_t;
  477. struct sdp_data_struct {
  478.     uint8_t dtd;
  479.     uint16_t attrId;
  480.     union {
  481.         int8_t    int8;
  482.         int16_t   int16;
  483.         int32_t   int32;
  484.         int64_t   int64;
  485.         uint128_t int128;
  486.         uint8_t   uint8;
  487.         uint16_t  uint16;
  488.         uint32_t  uint32;
  489.         uint64_t  uint64;
  490.         uint128_t uint128;
  491.         uuid_t    uuid;
  492.         char     *str;
  493.         sdp_data_t *dataseq;
  494.     } val;
  495.     sdp_data_t *next;
  496.     int unitSize;
  497. };
  498.  
  499. #ifdef __cplusplus
  500. }
  501. #endif
  502.  
  503. #endif /* __SDP_H */
  504.